// MESSAGE ASCTEC_API_COMMAND PACKING

#define MAVLINK_MSG_ID_ASCTEC_API_COMMAND 10

typedef struct __mavlink_asctec_api_command_t
{
 int16_t imu_pub_period; ///<  imu publishing period 
 int16_t motor_rpm_pub_period; ///<  motor rpm publishing period 
 int16_t rc_data_pub_period; ///<  rc data publishing period 
 int16_t gps_data_pub_period; ///<  gps data publishing period 
 uint8_t control_mode; ///<  control mode 
 uint8_t publishing_mode; ///<  publishing mode 
} mavlink_asctec_api_command_t;

#define MAVLINK_MSG_ID_ASCTEC_API_COMMAND_LEN 10
#define MAVLINK_MSG_ID_10_LEN 10



#define MAVLINK_MESSAGE_INFO_ASCTEC_API_COMMAND { \
	"ASCTEC_API_COMMAND", \
	6, \
	{  { "imu_pub_period", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_asctec_api_command_t, imu_pub_period) }, \
         { "motor_rpm_pub_period", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_asctec_api_command_t, motor_rpm_pub_period) }, \
         { "rc_data_pub_period", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_asctec_api_command_t, rc_data_pub_period) }, \
         { "gps_data_pub_period", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_asctec_api_command_t, gps_data_pub_period) }, \
         { "control_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_asctec_api_command_t, control_mode) }, \
         { "publishing_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_asctec_api_command_t, publishing_mode) }, \
         } \
}


/**
 * @brief Pack a asctec_api_command message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param control_mode  control mode 
 * @param publishing_mode  publishing mode 
 * @param imu_pub_period  imu publishing period 
 * @param motor_rpm_pub_period  motor rpm publishing period 
 * @param rc_data_pub_period  rc data publishing period 
 * @param gps_data_pub_period  gps data publishing period 
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_asctec_api_command_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
						       uint8_t control_mode, uint8_t publishing_mode, int16_t imu_pub_period, int16_t motor_rpm_pub_period, int16_t rc_data_pub_period, int16_t gps_data_pub_period)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[10];
	_mav_put_int16_t(buf, 0, imu_pub_period);
	_mav_put_int16_t(buf, 2, motor_rpm_pub_period);
	_mav_put_int16_t(buf, 4, rc_data_pub_period);
	_mav_put_int16_t(buf, 6, gps_data_pub_period);
	_mav_put_uint8_t(buf, 8, control_mode);
	_mav_put_uint8_t(buf, 9, publishing_mode);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 10);
#else
	mavlink_asctec_api_command_t packet;
	packet.imu_pub_period = imu_pub_period;
	packet.motor_rpm_pub_period = motor_rpm_pub_period;
	packet.rc_data_pub_period = rc_data_pub_period;
	packet.gps_data_pub_period = gps_data_pub_period;
	packet.control_mode = control_mode;
	packet.publishing_mode = publishing_mode;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 10);
#endif

	msg->msgid = MAVLINK_MSG_ID_ASCTEC_API_COMMAND;
	return mavlink_finalize_message(msg, system_id, component_id, 10, 163);
}

/**
 * @brief Pack a asctec_api_command message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message was sent over
 * @param msg The MAVLink message to compress the data into
 * @param control_mode  control mode 
 * @param publishing_mode  publishing mode 
 * @param imu_pub_period  imu publishing period 
 * @param motor_rpm_pub_period  motor rpm publishing period 
 * @param rc_data_pub_period  rc data publishing period 
 * @param gps_data_pub_period  gps data publishing period 
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_asctec_api_command_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
							   mavlink_message_t* msg,
						           uint8_t control_mode,uint8_t publishing_mode,int16_t imu_pub_period,int16_t motor_rpm_pub_period,int16_t rc_data_pub_period,int16_t gps_data_pub_period)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[10];
	_mav_put_int16_t(buf, 0, imu_pub_period);
	_mav_put_int16_t(buf, 2, motor_rpm_pub_period);
	_mav_put_int16_t(buf, 4, rc_data_pub_period);
	_mav_put_int16_t(buf, 6, gps_data_pub_period);
	_mav_put_uint8_t(buf, 8, control_mode);
	_mav_put_uint8_t(buf, 9, publishing_mode);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 10);
#else
	mavlink_asctec_api_command_t packet;
	packet.imu_pub_period = imu_pub_period;
	packet.motor_rpm_pub_period = motor_rpm_pub_period;
	packet.rc_data_pub_period = rc_data_pub_period;
	packet.gps_data_pub_period = gps_data_pub_period;
	packet.control_mode = control_mode;
	packet.publishing_mode = publishing_mode;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 10);
#endif

	msg->msgid = MAVLINK_MSG_ID_ASCTEC_API_COMMAND;
	return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 10, 163);
}

/**
 * @brief Encode a asctec_api_command struct into a message
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param asctec_api_command C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_asctec_api_command_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_asctec_api_command_t* asctec_api_command)
{
	return mavlink_msg_asctec_api_command_pack(system_id, component_id, msg, asctec_api_command->control_mode, asctec_api_command->publishing_mode, asctec_api_command->imu_pub_period, asctec_api_command->motor_rpm_pub_period, asctec_api_command->rc_data_pub_period, asctec_api_command->gps_data_pub_period);
}

/**
 * @brief Send a asctec_api_command message
 * @param chan MAVLink channel to send the message
 *
 * @param control_mode  control mode 
 * @param publishing_mode  publishing mode 
 * @param imu_pub_period  imu publishing period 
 * @param motor_rpm_pub_period  motor rpm publishing period 
 * @param rc_data_pub_period  rc data publishing period 
 * @param gps_data_pub_period  gps data publishing period 
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_asctec_api_command_send(mavlink_channel_t chan, uint8_t control_mode, uint8_t publishing_mode, int16_t imu_pub_period, int16_t motor_rpm_pub_period, int16_t rc_data_pub_period, int16_t gps_data_pub_period)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[10];
	_mav_put_int16_t(buf, 0, imu_pub_period);
	_mav_put_int16_t(buf, 2, motor_rpm_pub_period);
	_mav_put_int16_t(buf, 4, rc_data_pub_period);
	_mav_put_int16_t(buf, 6, gps_data_pub_period);
	_mav_put_uint8_t(buf, 8, control_mode);
	_mav_put_uint8_t(buf, 9, publishing_mode);

	_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASCTEC_API_COMMAND, buf, 10, 163);
#else
	mavlink_asctec_api_command_t packet;
	packet.imu_pub_period = imu_pub_period;
	packet.motor_rpm_pub_period = motor_rpm_pub_period;
	packet.rc_data_pub_period = rc_data_pub_period;
	packet.gps_data_pub_period = gps_data_pub_period;
	packet.control_mode = control_mode;
	packet.publishing_mode = publishing_mode;

	_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASCTEC_API_COMMAND, (const char *)&packet, 10, 163);
#endif
}

#endif

// MESSAGE ASCTEC_API_COMMAND UNPACKING


/**
 * @brief Get field control_mode from asctec_api_command message
 *
 * @return  control mode 
 */
static inline uint8_t mavlink_msg_asctec_api_command_get_control_mode(const mavlink_message_t* msg)
{
	return _MAV_RETURN_uint8_t(msg,  8);
}

/**
 * @brief Get field publishing_mode from asctec_api_command message
 *
 * @return  publishing mode 
 */
static inline uint8_t mavlink_msg_asctec_api_command_get_publishing_mode(const mavlink_message_t* msg)
{
	return _MAV_RETURN_uint8_t(msg,  9);
}

/**
 * @brief Get field imu_pub_period from asctec_api_command message
 *
 * @return  imu publishing period 
 */
static inline int16_t mavlink_msg_asctec_api_command_get_imu_pub_period(const mavlink_message_t* msg)
{
	return _MAV_RETURN_int16_t(msg,  0);
}

/**
 * @brief Get field motor_rpm_pub_period from asctec_api_command message
 *
 * @return  motor rpm publishing period 
 */
static inline int16_t mavlink_msg_asctec_api_command_get_motor_rpm_pub_period(const mavlink_message_t* msg)
{
	return _MAV_RETURN_int16_t(msg,  2);
}

/**
 * @brief Get field rc_data_pub_period from asctec_api_command message
 *
 * @return  rc data publishing period 
 */
static inline int16_t mavlink_msg_asctec_api_command_get_rc_data_pub_period(const mavlink_message_t* msg)
{
	return _MAV_RETURN_int16_t(msg,  4);
}

/**
 * @brief Get field gps_data_pub_period from asctec_api_command message
 *
 * @return  gps data publishing period 
 */
static inline int16_t mavlink_msg_asctec_api_command_get_gps_data_pub_period(const mavlink_message_t* msg)
{
	return _MAV_RETURN_int16_t(msg,  6);
}

/**
 * @brief Decode a asctec_api_command message into a struct
 *
 * @param msg The message to decode
 * @param asctec_api_command C-struct to decode the message contents into
 */
static inline void mavlink_msg_asctec_api_command_decode(const mavlink_message_t* msg, mavlink_asctec_api_command_t* asctec_api_command)
{
#if MAVLINK_NEED_BYTE_SWAP
	asctec_api_command->imu_pub_period = mavlink_msg_asctec_api_command_get_imu_pub_period(msg);
	asctec_api_command->motor_rpm_pub_period = mavlink_msg_asctec_api_command_get_motor_rpm_pub_period(msg);
	asctec_api_command->rc_data_pub_period = mavlink_msg_asctec_api_command_get_rc_data_pub_period(msg);
	asctec_api_command->gps_data_pub_period = mavlink_msg_asctec_api_command_get_gps_data_pub_period(msg);
	asctec_api_command->control_mode = mavlink_msg_asctec_api_command_get_control_mode(msg);
	asctec_api_command->publishing_mode = mavlink_msg_asctec_api_command_get_publishing_mode(msg);
#else
	memcpy(asctec_api_command, _MAV_PAYLOAD(msg), 10);
#endif
}
